package net.sxnic.jhitem.itemssmb.action;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @Description:  [一句话描述该类的功能]
 * @Author [姓名] [联系方式]
 * @CreateDate:
 * @UpdateDate:   
 * @Version 1.0
 */
 
public class Save extends ItemSsmbAction {
	private static final long serialVersionUID = 1L;

	private static Logger logger = LoggerFactory.getLogger(Save.class);

	private String ssmbId;
	
	public void prepare() throws Exception {
		if(StringUtils.isNotBlank(ssmbId))
		  itemSsmb = itemSsmbManager.get(ssmbId);
	}

	public String execute() throws Exception {
		
		if(StringUtils.isNotBlank(ssmbId)){
			itemSsmbManager.update(itemSsmb);
		}else{
			itemSsmb.setBaseinfoId(id);
			itemSsmbManager.save(itemSsmb);
		}	
		addActionMessage("保存成功");
		return SUCCESS;
	}

	public String getSsmbId() {
		return ssmbId;
	}

	public void setSsmbId(String ssmbId) {
		this.ssmbId = ssmbId;
	}
    
}
